package com.kun.utils;

import com.github.pagehelper.PageHelper;
import com.kun.dto.PageDomain;

public class PageUtils {

    /**
     * 当前记录起始索引
     */
    public static final String CURRENT = "current";

    /**
     * 每页显示记录数
     */
    public static final String PAGE_SIZE = "pageSize";

    /**
     * 设置请求分页数据
     */
    public static void startPage() {
        PageDomain pageDomain = new PageDomain(ServletUtils.getParameter(CURRENT), ServletUtils.getParameter(PAGE_SIZE));
        Integer pageNum = pageDomain.getCurrent();
        Integer pageSize = pageDomain.getPageSize();
        PageHelper.startPage(pageNum, pageSize).setReasonable(true);
    }

}
